import React, { Component } from 'react'
import GridContainer from './Grid.style'

export default class Grid extends Component {

  static defaultProps = {
    hasMore: false,
    imgRadius:0.15,
    itemClick:()=>{}
  }

  render() {
    let Title = this.props.renderTitle;
    return (
      <GridContainer {...this.props} >
        <ul>
          {
            this.props.list.map((item, index) => {
              return (
                <li key={index}>
                  <img src={item.img} onClick={()=>{
                    this.props.itemClick()
                  }} alt="" />
                  <Title item={item}></Title>
                </li>
              )
            })
          }
          {
            this.props.hasMore ? <li>更多</li> : ''
          }
        </ul>
      </GridContainer>
    )
  }
}
